package com.suray.wcs.service.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.suray.commin.core.utils.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("wcs_port")
public class PortDB extends BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "port_id", type = IdType.AUTO)
    private Integer portId;
    @NotBlank(message = "库口名称不可为空！")
    private String portName;

    @NotBlank(message = "库口编码不可为空！")
    private String portCode;
    /**
     * 库口模式
     */
    @NotNull(message = "库口模式不可为空！")
    private Integer portMode;
    private String scanName;
    private String weightName;
    private String shapeName;
    private String stations;
//    private String buttonName;
    /**
     * 是否启用状态 0：启用 1：禁用
     */
    private Integer status;

    private Integer connectMode;

    /**
     * 方案包含的设备编号
     */
    @TableField(exist = false)
    private Long[] plcDeviceIds;

    /**
     * 给前端展示
     */
    @TableField(exist = false)
    private String stationStr;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        PortDB portDB = (PortDB) o;
        return Objects.equals(portId, portDB.portId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), portId);
    }
}
